<template>
  <div class="layout">
    <el-container class="container">
      <el-aside width="200px">
        <!-- 侧边栏的组件 -->
        <v-aside></v-aside>
      </el-aside>
      <el-container>
        <el-header>
          <router-link to="/login">
            <el-button @click="removeUserInfo">退出登录</el-button></router-link
          >
        </el-header>
        <el-main>
          <!-- 各个模块的组件 -->
          <router-view> </router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import vAside from "./aside";
import { mapMutations } from "vuex";
export default {
  components: { vAside },
  methods: {
    ...mapMutations([
      "removeUserInfo"
    ]),
  },
};
</script>

<style>
/* 覆盖element ui样式的方法，给组件的根元素加上一个class，覆盖的样式都以他为父元素 */
.layout .container {
  /* vh:viewport height 视图高度 屏幕高度*/
  /* vw:viewport width 视图宽度 屏幕宽度; */
  height: 100vh;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  /* text-align: center;
  line-height: 160px; */
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>